package org.wuqi.microweb.api.testmethod;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author jjj
 * @program: earnest-money
 * @description:TODO
 * @date 2024-01-03 14:14:54
 */
@Component
public class SyncThread3 {
    private Logger logger = LoggerFactory.getLogger(SyncThread3.class);
    @Async
    public void doTask1() {
        long t1 = System.currentTimeMillis();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        long t2 = System.currentTimeMillis();
        logger.info("task1 cost {} ms" , t2-t1);
    }
    @Async
    public void doTask2() {
        long t1 = System.currentTimeMillis();
        logger.info("doTask2===");
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        long t2 = System.currentTimeMillis();
        logger.info("task2 cost {} ms" , t2-t1);
    }

}
 
 